# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-cython-lint
pkgver=0.12.4
pkgrel=2
pkgdesc='A tool to lint Cython files'
arch=('any')
url='https://github.com/MarcoGorelli/cython-lint'
license=('MIT')
depends=(
  'python'
  'cython'
  'python-tokenize-rt'
  'python-pycodestyle'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-pytest')
_commit='70376e0bdd6660977155881105e8492a14adbf20'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  PYTHONPATH="$(pwd)" pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
